<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:param name="pathFile" select="'test'"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="A4" page-width="297mm" page-height="210mm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
                    <fo:region-body margin="1cm"/>
                    <fo:region-before extent="1cm"/>
                    <fo:region-after extent="1cm"/>
                </fo:simple-page-master>
            </fo:layout-master-set>

            <fo:page-sequence master-reference="A4">
                <fo:static-content flow-name="xsl-region-before">
                    <fo:block font-size="14" font="Paladino Linotype" text-align="center" padding-after="10px">
                        Places to go to
                    </fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
                    <fo:block>
                        <fo:table border-width="0">
                            <fo:table-column width="1cm"/>
                            <fo:table-column width="7cm"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block text-align="center">Number</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block text-align="center">Places to go to</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <xsl:for-each select="//*[local-name() = 'placeInList']">
                                    <fo:table-row>
                                        <fo:table-cell>
                                            <fo:block text-align="center">
                                                <xsl:number level="single" count="//*[local-name() = 'placeInList']"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block text-align="center">
                                                <fo:external-graphic>
                                                    <xsl:attribute name="src">
                                                        <xsl:value-of select="concat($pathFile, ./*[local-name() = 'picturePath']"/>
                                                    </xsl:attribute>
                                                </fo:external-graphic>
                                                <xsl:value-of select="//*[local-name() = 'name']"/>
                                            </fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </xsl:for-each>
                            </fo:table-body>
                        </fo:table>
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>
